package cn.sail.ssm.shop.controller;

import cn.sail.ssm.shop.exceptions.BusinessException;
import cn.sail.ssm.shop.pojo.entity.User;
import cn.sail.ssm.shop.pojo.vo.ResultVO;
import cn.sail.ssm.shop.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("/user")
@Api(tags = "用户业务接口")
@ResponseBody
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/getUser",method = RequestMethod.POST)
    @ApiOperation("根据ID获取用户信息")
    public ResultVO getUser(Long id, HttpServletRequest request, HttpServletResponse response){
        ResultVO resultVO = new ResultVO();
        resultVO.addData("user",userService.selectById(id));
        return resultVO;
    }

}
